This screencast is a part of the epic learning series "Four weeks of Drupal", chapter "Writing a module". You can view the full series at http://dev.nodeone.se/en/four-weeks-of-drupal.
Please post any comments over there, or we won't see them. Sorry.
---
This screencasts introduces the concept of *hooks* â functions that, thanks to their names, are recognized and called by Drupal at certain events.
In particular, this screencast shows how a module registers new paths on your Drupal site, by implementing "hook_menu". It shows some aspects of using this hook:
* Declaring new paths
* Declaring a callback function
* Setting access to the path
* Setting which menu the page should appear
This screencast also points out that you'll need to clear the cache to see changes in the menu items.
Code added to wordlist.module
/**
* Implements hook_menu().
*/
function wordlist_menu() {
$items['admin/config/content/wordlist'] = array(
'title' => 'Word list',
'description' => 'Manage the list of globally available words on your site.',
'page callback' => 'wordlist_page',
'access callback' => 'user_access',
'access arguments' => array('administer_site_configuration'),
'menu_name' => 'management',
);
return $items;
}
/**
* Builds the page for configuring Word list.
*/
function wordlist_page() {
return 'Hello world!';
}
---
This screencast is a part of the epic learning series "Four weeks of Drupal", chapter "Writing a module". You can view the full series at http://dev.nodeone.se/en/four-weeks-of-drupal.
Please post any comments over there, or we won't see them. Sorry.